'''
    获取网页中的图片
'''
# 请求网页 获取
import requests
import re
headers = {'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.92 Safari/537.36'}
response = requests.get('https://www.vmgirls.com/13635.html', headers = headers)
htmls = response.text

# 解析网页
url = re.findall('<a href="(.*?)" alt=".*?" title=".*?">', htmls)
# print(url)

# 保存图片
for picture in url:
    
    
    # 获取图片链接已反斜杠为分割最后一个分割点的字符串
    file_name = picture.split('/')[-1]
   # 
    response = requests.get(picture, headers = headers)
    with open(file_name, 'wb') as f:
        f.write(response.content)
        
        
   

